package com.sdjz.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sdjz.dao.StudentDao;
import com.sdjz.domain.Student;
/**
 * 学生信息管理模块业务处理
 * 
 * @author Administrator
 *
 */

@Transactional
@Service
public class StudentService {
	
	@Autowired
	private StudentDao studentDao;
	
	/**
	 * 查询所有学生信息
	 * @return List<Student>
	 */
	public List<Student> findStudentByAll(){
		return studentDao.findByAll();
	}
	
	/**
	 * 添加学生信息
	 * @param student
	 */
	public void addStudent(Student student){
		studentDao.insert(student);
	}
	
	/**
	 * 删除学生信息
	 * @param id
	 */
	public void deleteStudent(Student student){
		studentDao.delete(student);
	}
	
	/**
	 * 修改学生信息
	 * @param student
	 */
	public void updateStudent(Student student){
		studentDao.update(student);
	}
	
	/**
	 * 根据id号查询学生信息
	 * @param id
	 * @return Student
	 */
	public Student findStudentById(Integer id){
		return studentDao.findById(id);
	}
}
